_ssss_eeee_mmmm______oooo_pppp_eeee_nnnn opens a semaphore named by the character string at address _n_a_m_e.
The _o_f_l_a_g parameter is used when creating a semaphore, supporting the
following bit flags:
_OOOO______CCCC_RRRR_EEEE_AAAA_TTTT
If the semaphore already exists, this flag has no effect, except as
noted under _OOOO______EEEE_XXXX_CCCC_LLLL below. Otherwise, the semaphore is created. The
initial value of the semaphore may be specified by _v_a_l_u_e, where
_v_a_l_u_e is any non-negative number less than {SEM_VALUE_MAX} [see
_ssss_yyyy_ssss_cccc_oooo_nnnn_ffff(3C)].
Named semaphores are represented by files in the file namespace
(commands like _llll_ssss will display named semaphores as regular files).
Because of this relationship, named semaphores inherit their access
semantics from files. The owner ID of the semaphore is set to the
effective user IDs of the process, the group ID of the semaphore is
set to the effective group IDs of the process or to the group ID of
the directory in which the semaphore is being created. This is
determined as follows:
If the underlying filesystem was mounted with the BSD file
creation semantics flag [see _ffff_ssss_tttt_aaaa_bbbb(4)] or the _SSSS______IIII_SSSS_GGGG_IIII_DDDD bit is
set [see _cccc_hhhh_mmmm_oooo_dddd(2)] on the parent directory, then the group ID
of the new file is set to the group ID of the parent directory,
otherwise it is set to the effective group ID of the calling
process.
If the group ID of the semaphore does not match the effective
group ID, or one of the supplementary groups IDs, the _SSSS______IIII_SSSS_GGGG_IIII_DDDD
bit is cleared. The access permission bits of the file mode
are set to the value of _m_o_d_e, modified as follows:
All bits set in the file mode creation mask of the process
are cleared [see _uuuu_mmmm_aaaa_ssss_kkkk(2)].
The ``save text image after execution bit'' of the mode is
cleared [see _cccc_hhhh_mmmm_oooo_dddd(2)].
_OOOO______EEEE_XXXX_CCCC_LLLL If _OOOO______EEEE_XXXX_CCCC_LLLL and _OOOO______CCCC_RRRR_EEEE_AAAA_TTTT are set, _ssss_eeee_mmmm______oooo_pppp_eeee_nnnn will fail if the named
semaphore exists. The check for the existence of the semaphore
and the creation of the name in the file namespace is atomic with
respect to other processes executing _ssss_eeee_mmmm______oooo_pppp_eeee_nnnn naming the same